package com.njworkorder.Utils;


import java.math.BigInteger;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
import java.util.stream.Stream;

public enum NoCode {
    LM,//0
    YX,
    JA,
    LJ,
    LH,//4
    SD,
    QJ,
    QH,
    RW, //8

    LX,//路线
    LD,//路段
    GQ,//工区

    JSJK;

    public static String getNoCode(String num) {
        BigInteger bigInteger = new BigInteger(num).add(BigInteger.ONE);
        return num.substring(0, Math.max(num.length() - bigInteger.toString().length(), 0)) + bigInteger;
    }

    public static String  getApprovalDescription(int type){
        return switch (type) {
            case 0 -> "创建任务单";
            case 1 -> "任务单审核";
            case 4 -> "接单维修提交";
            case 5, 6 -> "验收初审";
            case 7, 8 -> "验收终审";
            default -> "";
        };
    }


    public static List<Map<String, String>> getDModel() {
        return Stream.of(
                createMap("路面", "1"),
                createMap("沿线", "2"),
                createMap("交安", "3"),
                createMap("路基", "4"),
                createMap("绿化", "5"),
                createMap("清洁", "6"),
                createMap("桥涵", "7")
        ).collect(Collectors.toList());
    }

    private static Map<String, String> createMap(String name, String dModel) {
        return Map.of("name", name, "dModel", dModel);
    }

}
